<?php
define('check', true);
session_start();
require_once './config.php';
$appid = appid;
//存入session
$_redirect_uri = $_GET['redirect_uri']; //urlencode处理
if (empty($_redirect_uri)) {
    return;
}
$_SESSION['redirect_uri'] = $_redirect_uri;

$redirect_uri = urlencode('http://' . $_SERVER['HTTP_HOST'] . '/info.php');

$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$appid}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";

//开始跳转获取code
header("Location: {$url}");
